# name : dplyr::group lag/previous obs
# key : group.lag
# key : dplyr.group.lag
# key : lag.group
# contributor: Shuguang Sun
# --
group_by(${1:id}) |>
arrange(${2:index}, .by_group = TRUE) |>
mutate(dplyr::lag()) |>
ungroup()